/**
 * @author mi
 * @date 2018/12/3
 * @project wxapp-kachebbs
 */
export const authUserVerify = (module, success) => {
  getApp().updateGlobalData((userInfo) => {
    let {is_verify, group_id} = userInfo
    console.log(module)
    if (group_id == 2 && module == 'bg') {
      wx.showModal({
        title: '提示',
        content: '抱歉，商家无权限查看~',
        success ({confirm}) {
          if (confirm) {
            wx.navigateTo({
              url: '/pages/init/step2?role=' + group_id,
            })
          }
        }
      })
      return false
    }
    
    if (is_verify == 0) {
      wx.showModal({
        title: '提示',
        content: '您还未认证，请先完善个人信息, 如已提交资料请等待审核通过~',
        success ({confirm}) {
          if (confirm) {
            wx.navigateTo({
              url: '/pages/init/step2?role=' + group_id,
            })
          }
        }
      })
      return false
    }
  
    if (is_verify == 2) {
      wx.showModal({
        title: '提示',
        content: '资料审核未通过，请先去修改资料吧~',
        success ({confirm}) {
          if (confirm) {
            wx.navigateTo({
              url: '/pages/init/step2?role=' + group_id,
            })
          }
        }
      })
      return false
    }
  
    if (is_verify == 3) {
      wx.showModal({
        title: '提示',
        showCancel: false,
        content: '资料正在审核中，请耐心等待哦~'
      })
      return false
    }
  
    success && success(userInfo)
  })
}
